class ObjectType < ActiveRecord::Base

  validates_presence_of :name
  validates_uniqueness_of :name

  has_many :categorisations
  has_many :entities, :through => :categorisations
  
  
  def self.find_or_create(params)
    object_type = ObjectType.find_by_name(params[:name])
    
    unless object_type
      object_type = ObjectType.new(params)
      object_type.save
    end  
    
    return object_type
  end
  


end
